#include <bits/stdc++.h>

using namespace std;

const int MAXN = 1010;

typedef struct {int v,nxt;}edge;

int f[MAXN][5],n,h[MAXN],cnt;
edge e[MAXN<<1];

void link(int x,int y){e[++cnt] = edge{y,h[x]};h[x] = cnt;}

void dfs(int x){
	f[x][0] = 1;f[x][3] = f[x][4] = 0;
	int delta1 = n,delta2 = n;
	for(int i = h[x];i;i = e[i].nxt){
		int y = e[i].v;
		dfs(y);
		f[x][0] += f[y][4];
		f[x][1] += f[y][3]; delta1 = min(delta1,f[y][0] - f[y][3]);
		f[x][2] += f[y][2]; delta2 = min(delta2,f[y][1] - f[y][2]);
		f[x][3] += f[y][2];
		f[x][4] += f[y][3];
	}
	if(!h[x]){
		f[x][1] = f[x][2] = 1;
	}else{
		f[x][1] += delta1;
		f[x][2] += delta2;
	}
	for(int i = 1;i <= 4;i++) f[x][i] = min(f[x][i],f[x][i-1]);
}

int main (){
	scanf("%d",&n);
	for(int i = 2;i <= n;i++){
		int x;scanf("%d",&x);
		link(x,i);
	}
	dfs(1);
	printf("%d\n",f[1][2]);
	return 0;
}
